#ifndef _BOOT_H_
#define _BOOT_H_

#define ENABLE_PTIME()          *(volatile unsigned int *) 0x40004004 |= BIT(7)
#define DISABLE_PTIME()          *(volatile unsigned int *) 0x40004004 &= ~BIT(7)
#define ENABLE_EDSSI()          *(volatile unsigned int *) 0x40004004 |= BIT(3)
#define DISABLE_EDSSI()          *(volatile unsigned int *) 0x40004004 &= ~BIT(3)
#define ENABLE_ELSI()          *(volatile unsigned int *) 0x40004004 |= BIT(2)
#define DISABLE_ELSI()          *(volatile unsigned int *) 0x40004004 &= ~BIT(2)
#define ENABLE_ETBEI()          *((volatile unsigned int *) 0x40004004) |= BIT(1)
#define DISABLE_ETBEI()          *(volatile unsigned int *) 0x40004004 &= ~BIT(1)
#define ENABLE_ERBFI()          *(volatile unsigned int *) 0x40004004 |= BIT(0)
#define DISABLE_ERBFI()          *(volatile unsigned int *) 0x40004004 &= ~BIT(0)


typedef struct {
	uint32_t flag_updataNumber;		//Flag: 0xAA55 ,updateFile number 当为0时，进入BootLoader OTA单bank升级模式；当为1时，进行双bank升级代码搬移；其他值时正常加载代码运行
	uint32_t updateFile_addr;		//updateFile 1 address in flash
	uint32_t bin_lenght;			//ota bin file lenght
	uint32_t updateFile_type;		//0-BootLoader升级文件；1-应用程序
	uint32_t updateFile_checksum;	//file CRC16 checksum
}OtaUpdateInfo_t;


void hal_uart_tx(unsigned char *str);
void boot_app(void);

#endif

